package com.password.desktop.UI;

import java.awt.Color;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;

import javax.swing.JTextArea;
import javax.swing.border.Border;
import javax.swing.text.DefaultHighlighter;

import com.password.desktop.util.SysUtil;

public class PMTextArea extends JTextArea implements FocusListener {

	private static final long serialVersionUID = 1L;
	private Border focusBorder = new MotifBorders.FocusBorder(new Color(204, 204, 204), new Color(102, 175, 233));

	public PMTextArea() {
		init();
	}

	public void init() {
		setBorder(focusBorder);
		setFont(SysUtil.FONT_DEFAULT);
		setBackground(Color.white);
		setForeground(new Color(85, 85, 85));
		setHighlighter(new DefaultHighlighter());
		setLineWrap(true); // 激活自动换行功能
		setWrapStyleWord(true); // 激活断行不断字功能
		addFocusListener(this);
		setOpaque(true);
	}

	@Override
	public void focusGained(FocusEvent e) {
		repaint();
	}

	@Override
	public void focusLost(FocusEvent e) {
		repaint();
	}

}
